home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cug233 / make.h < prev    next >
Text File  |  1987-06-30  |  3KB  |  79 lines

  1. /*    
  2.  *    Program Name    : MAKE.H
  3.  *    Author        : Allen Holub
  4.  *    Implementor    : Kenji Hino
  5.  *    Description    : This is a header file for MAKE.C
  6.  *    Compiler    : Microsoft C ver.4.0, Lattice C ver. 3
  7.  */
  8.  
  9. #define    MICRO_C
  10. /* #define    LATTICE_C */
  11.  
  12. #include "stdio.h"
  13. #include "stdlib.h"
  14. #include "fcntl.h"
  15. #include "dos.h"
  16. #include "string.h"
  17. #include "time.h"
  18.  
  19. #ifdef    MICRO_C
  20. #include <sys\types.h>
  21. #include <sys\stat.h>
  22. #include <io.h>
  23. #include <memory.h>
  24. #include <malloc.h>
  25. #endif
  26.  
  27. /* define NEVER    */        /* for debugging */
  28.  
  29. #ifdef    NEVER
  30. #define DEBUG        1    /* Include for debug diags in make() */
  31. #endif
  32.  
  33. #define    MAXLINE        (80*10)    /* Maximum input line length */
  34. #define MAXBLOCK    64     /* Max number of lines in an action */
  35. #define MAXDEP        32    /* Max number of dependencies */
  36. #define    COMMENT        '#'    /* Delimits a comment */
  37. #define MAKEFILE    "mkfile" /* Name of makefile */
  38. #define DATETIME    0x57    /* "to get or set file's date & time */
  39. #define    DEFTIME        0x0    /* The default time returned by gtime when a */
  40.                 /* file doesn't exist */
  41.                 
  42. /* iswhite(c)        evaluates true if c is white space.
  43.    skipwhite(s)        skips the character pointer s past any white space
  44.    skipnonwhite(s)    skips s past any non-white characters.
  45. */
  46.  
  47. #define iswhite(c)    ((c) == ' ' || (c) == '\t')
  48. #define skipwhite(s)    while( iswhite(*s) )    ++s;
  49. #define    skipnonwhite(s)    while( *s && !iswhite(*s) ) ++s;
  50.  
  51.  
  52. /* 
  53.     The entire makefile is read into memory before it's processed. It's
  54.     stored in a bimary tree composed of the following structures:
  55.     depends_on and do_this are argv-like arrays of the pointers to character
  56.     pointers. The arrays are null terminated so no count is required.
  57.     The time field is a 32 bit long consisting of the date and time
  58.     fields returned from a DOS 0x57 call. The date and time are
  59.     concatenated with the date in the most siginificant 16 bits and the
  60.     time in the least significant. This way they can be compared as
  61.     a single number.
  62. */
  63.  
  64. typedef struct _tn
  65. {
  66.     struct _tn    *lnode;        /* pointer to left sub-tree */
  67.     struct _tn    *rnode;        /* pointer to right sub-tree */
  68.     char        *being_made;    /* name of file being made */
  69.     char         **depends_on;    /* names of dependant files */
  70.     char        **do_this;    /* Actions to be done to make file */
  71.     long        time;        /* time & date last modified */
  72. } TNODE;
  73.  
  74. static    TNODE        *Root    = 0;    /* Root of file-name tree */
  75. static    FILE        *Makefile;    /* Pointer to opened makefile */
  76. static     int         Inputline = 1;    /* current input line number */
  77. static    char        *First    = "";    /* Default file to make */
  78.  
  79.